All About Printing
Volume Number: 1
Issue Number: 9
Column Tag: Pascal Procedures
“All About Printing” 
By Alan Wootton, President, Top-Notch Productions, MacTutor
Contributing Editor
This month's topic is printing. As an example I present a program that will print
a message in large, 'banner' format. Perfect for parties!
To those of us who are familiar with the older generation of computers, printing
is a matter of sending data through ports and using printer control codes. For the Mac
we take these details for granted and will concentrate on using pre-packaged drivers
and on the details of GrafPorts.
Printing on the Mac is done through the Printing Manager, RAM software that is
considered part of the low-level operating system software. This code is stored in the
system file and loaded into RAM. The Printing Manager interfaces between your
program and the actual printer driver that controls the printer. The Imagewriter and
LaserPrinter files are printer drivers called by the Printing Manager. The "Choose
Printer" desk accessory switches between the two drivers so the Printing Manager has
the correct driver installed and ready to go. To be more specific, the Imagewriter and
LaserPrinter files are printer resource files, which contain device driver code within
them to drive the respective printer. The "Choose Printer" DA copies the selected
printer driver and it's data structures from the printer resource file into the system
file, and that's the driver that the Print Manger then uses. The idea is that a Mac
application can be written using printing manager calls and be printer independent,
since the printing manager would then interface to the appropriate device driver,
eliminating the need to re-code an application for a different printer. This ideal comes
close to being achieved on the Mac, probably more than any other computer system,
but is still far from perfect.
The intent of the Mac designers was that printing would be transparent to
quickdraw graphics "printed" on the screen. This was accomplished by using a special
quickdraw grafport for printing. Normal quickdraw routines are used to draw into this
port. The Printing Manager converts these quickdraw calls in your grafport to printer
calls to drive the printer instead of the screen. In this way, printing is supposed to be
transparent to a normal screen drawing operation. It also explains the complexity of
printing, since it involves all the quickdraw screen graphics technology.
Draft versus Standard Quality
The Printing Manager is responsible for the dialog boxes that appear prior to
printing and for allowing draft or standard quality printing. These two modes are
fundamentally different. In draft mode, the ascii representation of the quickdraw calls
are sent to the printer, which prints the text of the document using the character
generator within the printer. Hence no graphics are supported except character
graphics or modes directly supported by the printer and driven by the user's program.
The printer responds to it's own command codes rather than any of the "Mac" like
graphics.